/*
 * player.h
 *
 *  Created on: 15 nov. 2010
 *      Author: Nicolas Aucouturier, Laurent R�veill�re
 */

#ifndef PLAYER_H_
#define PLAYER_H_

#include <stdio.h>
#include <stdlib.h>
#include "SDL.h"
#include "SDL_image.h"
#include "../include/constant.h"

enum e_way {
	NORTH = 0, SOUTH, WEST, EAST
};

typedef struct s_player * t_player;

//To manage the map
extern void player_set_var_map(t_player player,int x);
extern int player_get_var_map(t_player player);
extern void reinitialise_player_var_map(t_player player);
extern int player_get_numb_map(t_player player);

//To manage the level and the number of the level
extern int player_get_numb_level(t_player player);
extern void init_numb_level(t_player player);
extern void inc_numb_level(t_player player);
extern int player_get_numb_level_old(t_player player);
extern void inc_numb_level_old(t_player player);
extern void player_set_old_level(t_player player,int x);


extern void player_set_bomb_range(t_player player,int x);
extern void player_set_nb_bomb(t_player player,int x);

//To manage the key; get one key when we walk on it
extern int player_get_key(t_player player);
extern void inc_player_key(t_player player);

extern int player_get_monster_or_not(t_player player);    /*pour éviter que le player ne perde 2 vie si le monstre et lui se dirige vers la meme case*/


// Creates a new player with a given number of available bombs
extern t_player player_init(int bomb_number,int life_number,int var,int init_x,int init_y,int num_map);
extern void player_free(t_player player);


// Returns the current position of the player
extern int player_get_x(t_player player);
extern int player_get_y(t_player player);


extern int player_get_bomb_range(t_player player);
extern void player_inc_bomb_range(t_player player);
extern void player_dec_bomb_range(t_player player);

// Set the direction of the next move of the player
extern void player_set_current_way(t_player player, enum e_way way);

// Set, Increase, Decrease the number of bomb that player can put
extern int player_get_nb_bomb(t_player player);
extern void player_inc_nb_bomb(t_player player);
extern void player_dec_nb_bomb(t_player player);

// Set, Increase, Decrease the number of life that player can put
extern int player_get_nb_life(t_player player);
extern void player_inc_nb_life(t_player player);
extern void player_dec_nb_life(t_player player);

// Load the player position from the map
extern void player_from_map(t_player player, t_map map);

// Move the player according to the current direction
extern int player_move(t_player player, t_map map);

// Display the player on the screen
extern void player_display(t_player player, SDL_Surface *screen);

extern void bonus_management(t_map map,t_player player,int x,int y);

#endif /* PLAYER_H_ */
